Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

requizzle

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requizzle

Swizzle a little something into your require() calls.

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3M
increased by31.1%
Maintainers
1
Weekly downloads
 
Created

What is requizzle?

The requizzle npm package is designed to modify the behavior of Node.js's require function. It allows users to intercept and modify the module loading process, which can be useful for a variety of tasks such as injecting dependencies, modifying module exports, or applying patches to modules before they are returned by require.

What are requizzle's main functionalities?

Intercepting and modifying module loading

This feature allows you to create a custom require function that can intercept the module loading process. The 'requirePaths' option specifies additional paths to search for modules. The 'infect' option, when set to true, causes all subsequently required modules to also be loaded with this custom require function.

const Requizzle = require('requizzle');
const options = {
  requirePaths: [__dirname],
  infect: true
};
const myRequire = Requizzle(options);
const myModule = myRequire('./myModule');

Modifying module exports

This feature allows you to add extra properties or methods to the exports of any module loaded with the custom require function. The 'extras' option is a function that receives the target module's exports and can modify them before they are returned.

const Requizzle = require('requizzle');
const options = {
  extras: function (target) {
    target.extraProperty = 'This is an extra property!';
  }
};
const myRequire = Requizzle(options);
const myModule = myRequire('./myModule');
console.log(myModule.extraProperty);

Other packages similar to requizzle

Keywords

FAQs

Package last updated on 26 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc